<template>
    <div>
        <div v-for="item in treeData" :key="item.id">
            <el-submenu
                    :index="String(item.id)"
                    v-if="item.children && item.children.length > 0 && item.children[0].type.toString() === '0'">
                <template slot="title">
                    <i :class="item.icon"></i>
                    <span slot="title">{{item.menuName}}</span>
                </template>
                <el-menu-item-group>
                    <MenuTmp :treeData="item.children"></MenuTmp>
                </el-menu-item-group>
            </el-submenu>

            <el-menu-item
                    v-else-if="item.type.toString() === '0'" :index="item.url" :key="item.id">
                <i :class="item.icon"></i>
                <span slot="title">{{item.menuName}}</span>
            </el-menu-item>
        </div>
    </div>

</template>

<script>
    export default {
        name: "MenuTmp",
        data() {
            return {};
        },
        props: {
            treeData: {
                type: Array,
                default: function() {
                    return [];
                }
            }
        },
        created() {},
        methods: {}
    };
</script>

<style scoped lang="stylus">
    .el-menu-vertical-demo:not(.el-menu--collapse) {
        width: 200px;
        min-height: 0px !important;
    }
</style>

